

create Downloads folder in indicator folder of mt4 terminal and put all indicators in this folder for this templet to work.























































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































large arrow = daily trend
small arrow= H4 trend

----------------------------

large arrow up,- convergence of moving averages-yes, act only on small up arrow with blue candle and blue background( long builtup), exit on black candle= counter trend retracement(long unwinding)

large arrow down,- convergence of moving averages-yes, act only on small down arrow with red candle and red background( short builtup), exit on black candle= counter trend retracement(short covering)

wait for candle close.


us 30 years bond, s&p 500 and us dollar index are tightly linked, with interest rates as bridge
moves in this three moves all other financial asset classes and world markets.

what moves this three is interest rates in US, set by central bank policy of fed.

only central banks policy can change the course of market, 

reaction of market of all other news will be in the direction of the large timeframes trend .




























































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































//+------------------------------------------------------------------------------------------------------------------+
#property description                                                                                     "[XU-MA v3]"
#define Version                                                                                           "[XU-MA v3]"
//+------------------------------------------------------------------------------------------------------------------+
#property link        "https://forex-station.com/viewtopic.php?p=1295409935#p1295409935"
#property description "THIS IS A FREE INDICATOR"
#property description "                                                      "
#property description "Welcome to XARD UNIVERSE"
#property description "Let light shine out of darkness and illuminate your world"
#property description "and with this freedom leave behind your cave of denial"
#property indicator_chart_window
#property indicator_buffers 21
string ID,xTimeFrame                     = "Current time frame",TimeFrame="Current time frame";
extern string Indicator                  = Version;
//+------------------------------------------------------------------------------------------------------------------+
extern string STR01                      = "<<<==== [01] Candle Settings ====>>>";
  extern bool showCANDLES                = true;  int Type,getChartScale=WRONG_VALUE; extern int cWick=1;
 extern color CandleUp                   = C'96,170,204',CandleWt=C'34,34,34',CandleDn=C'255,140,255';
       double candle0[],candle1[],candle2[],candle3[],candle4[],candle5[],candle6[],candle7[];
//+------------------------------------------------------------------------------------------------------------------+
extern string STR02                      = "<<<==== [02] Openline Settings ====>>>";
  extern bool showDOP                    = TRUE;
   extern int DOPwidth                   = 5,DOPtf=1440;
 extern color DOPclr                     = C'60,60,60';  double DOP[];
//+------------------------------------------------------------------------------------------------------------------+
extern string STR03                      = "<<<==== [03] TREND Settings ====>>>";
  extern bool showTREND                  = true;  
 extern color TRENDupclr=clrBlue,TRENDdnclr=clrCrimson,Tbgdclr=C'100,130,160';
   extern int TRENDper=36,TRENDtf=0,TRENDshft=0,TRENDmode=MODE_EMA,TRENDtype=PRICE_MEDIAN,TRENDwidth=7;
         bool returnBars,calculateTREND;  double TREND[],TRENDdna[],TRENDdnb[],trend[],Tbgd[];
//+------------------------------------------------------------------------------------------------------------------+
extern string STR04                      = "<<<==== [04] SIGNAL Settings ====>>>";
  extern bool showSIGNAL                 = true; 
 extern color SIGNALupclr=clrBlue,SIGNALdnclr=clrCrimson,Sbgdclr=C'100,130,160';  
   extern int SIGNALper=9,SIGNALtf=0,SIGNALshft=0,SIGNALmode=MODE_EMA,SIGNALtype=PRICE_MEDIAN,SIGNALwidth=4;
         bool calculateSIGNAL;  double SIGNAL[],SIGNALdna[],SIGNALdnb[],signal[],Sbgd[];
//+------------------------------------------------------------------------------------------------------------------+
extern string STR05                      = "<<<==== [05] BGDzones Settings ====>>>";
  extern bool showBGDzones               = true;
   extern int CCIPrice                   = PRICE_TYPICAL; double Dummy=-1; double colors[];
 extern color ColorUp                    = C'53,72,110',ColorDown=C'120,63,82',ColorWait=C'91,103,112';
//+------------------------------------------------------------------------------------------------------------------+
extern string STR06                      = "<<<==== [06] BOXtxt Settings ====>>>";
  extern bool showBOXtxt                 = true,showSig=true;  int PanelBorderWidth=0;
 extern color PanelBorderColor           = C'120,120,120',clrW=clrGray,clrB=clrDeepSkyBlue,clrS=clrOrchid;
   extern int moveTxtLR                  = 0,moveTxtUD=0,FontSize=15; int BOXsize; string BOXtxt; color BOXclr,TXx;
//+------------------------------------------------------------------------------------------------------------------+
extern string STR07                      = "<<<==== [07] Alert Settings ====>>>";
  extern bool AlertsOn                   = true,
              AlertsOnCurrent            = true,
              AlertsMessage              = true,
              AlertsSound                = false,
              alertsNotify               = true,
              AlertsEmail                = false;  double xtrend[];
extern string soundfile                  = "alert1.wav"; int timeFrame,win; string indicatorFileName;
//+----OnInit Function-----------------------------------------------------------------------------------------------+
   int OnInit(){int Buff=21,Buf=-1; IndicatorBuffers(Buff);   xTimeFrame=stringToTimeFrame(xTimeFrame);
   if(TimeFrame==0 || TimeFrame<Period()) TimeFrame=Period();  timeFrame=stringToTimeFrame(TimeFrame);
   ID = "b"; IndicatorDigits(Digits); IndicatorShortName(ID); win=WindowFind(ID);
//+------------------------------------------------------------------------------------------------------------------+ 
   if(showCANDLES)        Type=DRAW_HISTOGRAM; else Type=DRAW_NONE;
   Buf+=1; SetIndexBuffer(Buf,candle0);    SetIndexStyle(Buf,Type,EMPTY,cWick,CandleUp);
   Buf+=1; SetIndexBuffer(Buf,candle1);    SetIndexStyle(Buf,DRAW_NONE);
   Buf+=1; SetIndexBuffer(Buf,candle2);    SetIndexStyle(Buf,Type,EMPTY,cWick,CandleWt);
   Buf+=1; SetIndexBuffer(Buf,candle3);    SetIndexStyle(Buf,Type,EMPTY,cWick,CandleDn);
   Buf+=1; SetIndexBuffer(Buf,candle4);    
   Buf+=1; SetIndexBuffer(Buf,candle5);    SetIndexStyle(Buf,DRAW_NONE);
   Buf+=1; SetIndexBuffer(Buf,candle6);    
   Buf+=1; SetIndexBuffer(Buf,candle7);    fSetBuffers();
//+------------------------------------------------------------------------------------------------------------------+
   if(showDOP)              Type=DRAW_LINE; else Type=DRAW_NONE;  
   if(Period()<=PERIOD_H1)DOPtf=1440; if(Period()==PERIOD_H4)DOPtf=10080; if(Period()>=PERIOD_D1)Type=DRAW_NONE;
   Buf+=1; SetIndexBuffer(Buf,DOP);       SetIndexStyle(Buf,Type,0,DOPwidth,DOPclr);
//+------------------------------------------------------------------------------------------------------------------+
   if(showTREND)            Type=DRAW_LINE; else Type=DRAW_NONE;  int TW=TRENDwidth,T1B=TW+4;
   if(Period()==PERIOD_M1) {TRENDper=36*5;} //off 15m use 36*15, off  5m use 36*5
   if(Period()==PERIOD_M5) {TRENDper=36*3;} //off 15m use 36*3,  off 1hr use 36*12
   if(Period()==PERIOD_M15){TRENDper=36*4;} //off 1hr use 36*4
   if(Period()==PERIOD_M30){TRENDper=36*2;} //off 1hr use 36*2
   if(Period()==PERIOD_H1) {TRENDper=36*1;} //off 1hr use 36*1
   Buf+=1; SetIndexBuffer(Buf,Tbgd);      SetIndexStyle(Buf,Type,0,T1B,Tbgdclr);
   Buf+=1; SetIndexBuffer(Buf,TREND);     SetIndexStyle(Buf,Type,0,TW,TRENDupclr); SetIndexDrawBegin(Buf,TRENDper+1);
   Buf+=1; SetIndexBuffer(Buf,TRENDdna);  SetIndexStyle(Buf,Type,0,TW,TRENDdnclr); SetIndexDrawBegin(Buf,TRENDper+1);
   Buf+=1; SetIndexBuffer(Buf,TRENDdnb);  SetIndexStyle(Buf,Type,0,TW,TRENDdnclr); SetIndexDrawBegin(Buf,TRENDper+1);
   Buf+=1; SetIndexBuffer(Buf,trend);     SetIndexStyle(Buf,DRAW_NONE);
//+------------------------------------------------------------------------------------------------------------------+
   if(showSIGNAL)           Type=DRAW_LINE; else Type=DRAW_NONE;  int SW=SIGNALwidth,S1B=SW+4;
   if(Period()==PERIOD_M1) {SIGNALper=9*5;} //off 15m use 9*15, off  5m use 9*5
   if(Period()==PERIOD_M5) {SIGNALper=9*3;} //off 15m use 9*3,  off 1hr use 9*12
   if(Period()==PERIOD_M15){SIGNALper=9*4;} //off 1hr use 9*4
   if(Period()==PERIOD_M30){SIGNALper=9*2;} //off 1hr use 9*2
   if(Period()==PERIOD_H1) {SIGNALper=9*1;} //off 1hr use 9*1
   Buf+=1; SetIndexBuffer(Buf,Sbgd);      SetIndexStyle(Buf,Type,0,S1B,Sbgdclr);
   Buf+=1; SetIndexBuffer(Buf,SIGNAL);    SetIndexStyle(Buf,Type,0,SW,SIGNALupclr); SetIndexDrawBegin(Buf,SIGNALper+1);
   Buf+=1; SetIndexBuffer(Buf,SIGNALdna); SetIndexStyle(Buf,Type,0,SW,SIGNALdnclr); SetIndexDrawBegin(Buf,SIGNALper+1);
   Buf+=1; SetIndexBuffer(Buf,SIGNALdnb); SetIndexStyle(Buf,Type,0,SW,SIGNALdnclr); SetIndexDrawBegin(Buf,SIGNALper+1);
   Buf+=1; SetIndexBuffer(Buf,signal);    SetIndexStyle(Buf,DRAW_NONE);
//+------------------------------------------------------------------------------------------------------------------+
   Buf+=1; SetIndexBuffer(Buf,colors);     SetIndexStyle(Buf,DRAW_NONE);
   Buf+=1; SetIndexBuffer(Buf,xtrend);     SetIndexStyle(Buf,DRAW_NONE);
//+------------------------------------------------------------------------------------------------------------------+
   if(Buff != Buf+1) Print("*******Buffer MisMatch!!!   ",Buff," ",Buf);
   for(int Bufx=0;Bufx<indicator_buffers;Bufx++){SetIndexLabel(Bufx,NULL);}  return(INIT_SUCCEEDED);}//End OnInit
//+----deinit Function-----------------------------------------------------------------------------------------------+
   int deinit(){CleanUpOnIsle1(); return(0);}//End deinit
//+----OnCalculate Function------------------------------------------------------------------------------------------+
   int OnCalculate(const int rates_total,
                   const int prev_calculated,
                   const datetime &time[],
                   const double &open[],
                   const double &high[],
                   const double &low[],
                   const double &close[],
                   const long &tick_volume[],
                   const long &volume[],
                   const int &spread[]){ fSetBuffers();
//+------------------------------------------------------------------------------------------------------------------+
   int i,limit,counted_bars=IndicatorCounted(); if(counted_bars<0) return(-1);
   if(counted_bars>0) counted_bars--; limit = MathMin(Bars-counted_bars,Bars-1);
//+---DAILY OPEN FUNCTION--------------------------------------------------------------------------------------------+
   if(timeFrame==Period()){for(i=limit;i>=0;i--){DOP[i]=iOpen(NULL,DOPtf,iBarShift(NULL,DOPtf,Time[i]));}}
//+---TREND FUNCTION-------------------------------------------------------------------------------------------------+
   if(returnBars){TREND[0]=limit+1; return(0);} if(calculateTREND || timeFrame == Period()){
   if(!calculateTREND && trend[limit]==-1) CleanPoint(limit,TRENDdna,TRENDdnb); 
   for(i=limit;i>=0;i--){TRENDdna[i]=EMPTY_VALUE; TRENDdnb[i]=EMPTY_VALUE; trend[i]=trend[i+1];
                 if(Close[i]>iMA(Symbol(),TRENDtf,TRENDper,TRENDshft,TRENDmode,PRICE_HIGH,i+1)) trend[i]= 1;
                 if(Close[i]<iMA(Symbol(),TRENDtf,TRENDper,TRENDshft,TRENDmode,PRICE_LOW, i+1)) trend[i]=-1;
   if(trend[i]==-1) TREND[i]=iMA(Symbol(),TRENDtf,TRENDper,TRENDshft,TRENDmode,TRENDtype,i+0);
              else  TREND[i]=iMA(Symbol(),TRENDtf,TRENDper,TRENDshft,TRENDmode,TRENDtype,i+0); Tbgd[i]=TREND[i];
   if(!calculateTREND && trend[i]==-1) PlotPoint(i,TRENDdna,TRENDdnb,TREND);}}
//+---SIGNAL FUNCTION------------------------------------------------------------------------------------------------+
   if(returnBars){SIGNAL[0]=limit+1; return(0);} if(calculateSIGNAL || timeFrame == Period()){
   if(!calculateSIGNAL && signal[limit]==-1) CleanPoint(limit,SIGNALdna,SIGNALdnb); 
   for( i=limit;i>=0;i--){SIGNALdna[i]=EMPTY_VALUE;  SIGNALdnb[i]=EMPTY_VALUE; signal[i]=signal[i+1];
                   if(Close[i]>iMA(Symbol(),SIGNALtf,SIGNALper,SIGNALshft,SIGNALmode,PRICE_HIGH,i+1)) signal[i]= 1;
                   if(Close[i]<iMA(Symbol(),SIGNALtf,SIGNALper,SIGNALshft,SIGNALmode,PRICE_LOW, i+1)) signal[i]=-1;
   if(signal[i]==-1) SIGNAL[i]=iMA(Symbol(),SIGNALtf,SIGNALper,SIGNALshft,SIGNALmode,SIGNALtype,i+0);
               else  SIGNAL[i]=iMA(Symbol(),SIGNALtf,SIGNALper,SIGNALshft,SIGNALmode,SIGNALtype,i+0); Sbgd[i]=SIGNAL[i];
   if(!calculateSIGNAL && signal[i]==-1) PlotPoint(i,SIGNALdna,SIGNALdnb,SIGNAL);}}
//+---BGD Zones Function---------------------------------------------------------------------------------------------+
   if(showBGDzones){ datetime tDummy=Dummy;  int CCIPeriod=TRENDper;
   if(timeFrame!=Period()){ 
   iCustom(NULL,timeFrame,indicatorFileName,"",CCIPeriod,CCIPrice,ID,ColorUp,ColorDown,Time[0],0,0); return(0);}
         else if(Dummy<=Time[0]) tDummy=Time[0];  static bool secondTime=false;
   if(secondTime){int count=0;
   for(;limit<Bars; limit++) if(colors[limit]!=colors[limit+1]){count++; if(count>1) break;}} else secondTime=true;
   double MaxValue=High[0]*10.0;   
   for(i=limit;i>=0;i--){if(i>Bars-2) continue;
        colors[i]=colors[i+1]; colors[i]=0;
   if(trend[i]== 1){colors[i]= 1;}
   if(trend[i]==-1){colors[i]=-1;}
   for(int index=i;index<Bars;index++) if(colors[index]!=colors[index+1]) break;
      string name=ID+"X"+Time[index+1]; ObjectDelete(name); ObjectDelete(ID+"X"+Time[1]);
    datetime lastTime = Time[i]; if (i==0) lastTime = tDummy;
      ObjectCreate(name,OBJ_RECTANGLE,0,Time[index+1],0,lastTime,MaxValue);
         ObjectSet(name,OBJPROP_BACK,true);
            switch ((int)colors[i]){
      case -1 : ObjectSet(name,OBJPROP_COLOR,ColorDown); break;
      case  0 : ObjectSet(name,OBJPROP_COLOR,ColorWait); break;
      case  1 : ObjectSet(name,OBJPROP_COLOR,ColorUp);   break;}}}//End of BGD Zones
//+---DIRECTIONAL TRADE----------------------------------------------------------------------------------------------+
   for(i=limit;i>=0;i--){string txtW=" WAITING . . .",txtB="   UP TREND",txtS="DOWN TREND";
   TXx=clrW; xtrend[i]=xtrend[i+1];  xtrend[i]= 0; candle(2,i); BOXtxt=txtW; BOXclr=C'40,40,40';
   if(trend[i]== 1 && signal[i]== 1){xtrend[i]= 1; candle(1,i); BOXtxt=txtB; BOXclr=clrDodgerBlue; TXx=clrB;}
   if(trend[i]==-1 && signal[i]==-1){xtrend[i]=-1; candle(3,i); BOXtxt=txtS; BOXclr=C'174,107,52'; TXx=clrS;}}
//+---BOXtxt DISPLAY-------------------------------------------------------------------------------------------------+
	if(showBOXtxt){SetPanel(0,ID+"Drax1",0,2,0,25,BOXsize,25,BOXclr,clrBlack,PanelBorderWidth,false);
          ObjectSetInteger(0,ID+"Drax1",OBJPROP_XSIZE,200);
          ObjectSetInteger(0,ID+"Drax1",OBJPROP_BGCOLOR,BOXclr);
SetLabel(0,ID+"Drax2",0,2,4,23,timeFrameToString(timeFrame)+" "+BOXtxt,16,"Arial Bold",clrSilver,0,false,true,0,ANCHOR_LEFT_UPPER);}
//+---XARDtxt DISPLAY------------------------------------------------------------------------------------------------+
   if(showSig){string txt7="XARD",txt8="UNIVERSE",txt9="VWAP Edition"; color TXbgd=C'34,34,34';
   double OpenToday=iOpen(NULL,1440,0),CLOSE=iClose(NULL,1440,0);
   if(CLOSE>OpenToday){color TXu=clrDodgerBlue;} else {TXu=clrMediumVioletRed;}
   SetLabel(0,ID+"Drax3",0,0,78 ,12,txt7,32,"BorisBlackBloxx",TXbgd,0,true,true,0,ANCHOR_LEFT_UPPER);
   SetLabel(0,ID+"Drax4",0,0,260,12,txt8,32,"BorisBlackBloxx",TXbgd,0,true,true,0,ANCHOR_LEFT_UPPER);
   SetLabel(0,ID+"Drax5",0,0,76 ,10,txt7,32,"BorisBlackBloxx",TXx,0,true,true,0,ANCHOR_LEFT_UPPER);
   SetLabel(0,ID+"Drax6",0,0,258,10,txt8,32,"BorisBlackBloxx",TXu,0,true,true,0,ANCHOR_LEFT_UPPER);
   SetLabel(0,ID+"Drax7",0,0,388,58,txt9,12,"BorisBlackBloxx",clrDarkGray,0,true,true,0,ANCHOR_LEFT_UPPER);}
//+------------------------------------------------------------------------------------------------------------------+
   manageAlerts(); return(rates_total);}//End OnCalculate
//+------------------------------------------------------------------------------------------------------------------+
   void CleanPoint(int i,double& first[],double& second[]){
   if((second[i]!=EMPTY_VALUE) && (second[i+1]!=EMPTY_VALUE)) second[i+1]= EMPTY_VALUE; else
   if((first[i]!=EMPTY_VALUE) && (first[i+1]!=EMPTY_VALUE) && (first[i+2]==EMPTY_VALUE)) first[i+1]=EMPTY_VALUE;}
//+------------------------------------------------------------------------------------------------------------------+
   void PlotPoint(int i,double& first[],double& second[],double& from[]){if(first[i+1] == EMPTY_VALUE){
   if(first[i+2] == EMPTY_VALUE) {first[i]=from[i]; first[i+1]=from[i+1]; second[i]=EMPTY_VALUE;}  else {
   second[i]=from[i]; second[i+1]=from[i+1]; first[i]=EMPTY_VALUE;}} else {first[i]=from[i]; second[i]=EMPTY_VALUE;}}
//+----Candle Function-----------------------------------------------------------------------------------------------+
   void candle(int direction,int i){
   double bodyHigh=MathMax(Open[i],Close[i]),bodyLow=MathMin(Open[i],Close[i]),high=High[i],low=Low[i];
   candle0[i]=low; candle1[i]=low; candle2[i]=low; candle3[i]=low;
   candle4[i]=bodyLow; candle5[i]=bodyLow; candle6[i]=bodyLow; candle7[i]=bodyLow;
   switch (direction) {case 1:candle0[i]=high; candle4[i]=bodyHigh; return;
                       case 2:candle2[i]=high; candle6[i]=bodyHigh; return;
                       case 3:candle3[i]=high; candle7[i]=bodyHigh; return;}}
//+------------------------------------------------------------------------------------------------------------------+
   void fSetBuffers(){int iChartScale = int(ChartGetInteger(0,CHART_SCALE)); if(getChartScale == iChartScale) return;
	getChartScale = iChartScale; int iW=0,rW=0; switch(iChartScale){
		case 0: iW=1; rW=1; break; case 1: iW=1; rW=2; break; case 2: iW= 2; rW= 3; break;
		case 3: iW=3; rW=5; break; case 4: iW=6; rW=9; break; case 5: iW=14; rW=17; break;}
	if(showCANDLES)        Type=DRAW_HISTOGRAM; else Type=DRAW_NONE;
	SetIndexStyle(4,Type,0,iW,CandleUp);
   SetIndexStyle(6,Type,0,iW,CandleWt);
   SetIndexStyle(7,Type,0,iW,CandleDn); ChartRedraw();}
//+---OnChartEvent Function------------------------------------------------------------------------------------------+
   void OnChartEvent(const int id, const long& lparam, const double& dparam, const string& sparam){
	if(id==CHARTEVENT_OBJECT_CLICK && ObjectGet(sparam,OBJPROP_TYPE)==OBJ_BUTTON){
   if(StringFind(sparam,ID+":back:"  ,0)==0) ObjectSet(sparam,OBJPROP_STATE,false); 
	if(IsStopped()) return; fSetBuffers();} OnInit();}
//+---Timeframe Function---------------------------------------------------------------------------------------------+
   string sTfTable[]={"M1","M5","M15","M30","H1","H4","D1","W1","MN"};
   int    iTfTable[]={1,5,15,30,60,240,1440,10080,43200};
//+------------------------------------------------------------------------------------------------------------------+
   int stringToTimeFrame(string tfs){ tfs=stringUpperCase(tfs);  for(int i=ArraySize(iTfTable)-1; i>=0; i--)
   if(tfs==sTfTable[i] || tfs==""+iTfTable[i]) return(MathMax(iTfTable[i],_Period));  return(_Period);}
//+------------------------------------------------------------------------------------------------------------------+
   string timeFrameToString(int tf){
   for(int i=ArraySize(iTfTable)-1;i>=0;i--)  if(tf==iTfTable[i]) return(sTfTable[i]); return("");}
//+------------------------------------------------------------------------------------------------------------------+
   string stringUpperCase(string str){ string s=str; for(int length=StringLen(str)-1; length>=0; length--){
   int tchar=StringGetChar(s,length); if((tchar>96 && tchar<123) || (tchar>223 && tchar<256))
   s=StringSetChar(s,length,tchar-32); else if(tchar>-33 && tchar<0) s=StringSetChar(s,length,tchar+224);} return(s);}
//+----Clean Chart Function------------------------------------------------------------------------------------------+
   void CleanUpOnIsle1(){string namem; for(int m=ObjectsTotal()-1; m>=0; m--){namem=ObjectName(m);
   if(StringSubstr(namem,0,StringLen(ID))==ID) {ObjectDelete(namem);}}}//EOF
//+----END OF FILE---------------------------------------------------------------------------------------------------+
   void manageAlerts(){if(AlertsOn){if(AlertsOnCurrent)
   int whichBar=0; else whichBar = 1; whichBar = iBarShift(NULL,0,iTime(NULL,0,whichBar));
   if(xtrend[whichBar] != xtrend[whichBar+1]){
   if(xtrend[whichBar] == 1) doAlert(whichBar,"UP");
   if(xtrend[whichBar] ==-1) doAlert(whichBar,"DOWN");}}}
//+------------------------------------------------------------------------------------------------------------------+
   void doAlert(int forBar, string doWhat){
   static string previousAlert="nothing"; static datetime previousTime; string msg;
   if(previousAlert != doWhat || previousTime != Time[forBar]){previousAlert=doWhat; previousTime=Time[forBar];
   msg=StringConcatenate(Symbol()," ",timeFrameToString(timeFrame)," : Direction changed to ",doWhat);
   if(AlertsMessage) Alert(msg); if(AlertsSound) PlaySound("alert.wav"); if(alertsNotify) SendNotification(msg);
   if(AlertsEmail) SendMail(msg,msg+"\nLocal time "+TimeToStr(TimeLocal(),
   TIME_SECONDS)+""+"\nBroker time "+TimeToStr(TimeCurrent(),TIME_SECONDS));}}//End ManageAlerts
//+----SetPanel Function---------------------------------------------------------------------------------------------+
   void SetPanel(long IDchart=0,string name="PanelX",int window=0,int corner=0,int PosX=0,int PosY=0,int width=0,int height=0,
   int bg_color=0,int border_color=0,int border_width=1,bool bg=true,bool del=false){if(StringLen(name)<1)return;
   if(del) ObjectDelete(IDchart,name); window=MathMax(window,0);
   if(bg_color<0) bg_color=White; if(border_color<0) border_color=White;
   if (ObjectCreate(IDchart,name,OBJ_RECTANGLE_LABEL,window,0,0)){
   ObjectSetInteger(IDchart,name,OBJPROP_XDISTANCE,PosX);
   ObjectSetInteger(IDchart,name,OBJPROP_YDISTANCE,PosY);
   ObjectSetInteger(IDchart,name,OBJPROP_XSIZE,width);
   ObjectSetInteger(IDchart,name,OBJPROP_YSIZE,height);
   ObjectSetInteger(IDchart,name,OBJPROP_COLOR,border_color);
   ObjectSetInteger(IDchart,name,OBJPROP_BORDER_TYPE,BORDER_FLAT);
   ObjectSetInteger(IDchart,name,OBJPROP_WIDTH,border_width);
   ObjectSetInteger(IDchart,name,OBJPROP_CORNER,corner);
   ObjectSetInteger(IDchart,name,OBJPROP_STYLE,STYLE_SOLID);
   ObjectSetInteger(IDchart,name,OBJPROP_BACK,bg);
   ObjectSetInteger(IDchart,name,OBJPROP_SELECTABLE,0);
   ObjectSetInteger(IDchart,name,OBJPROP_SELECTED,0);
   ObjectSetInteger(IDchart,name,OBJPROP_HIDDEN,true);
   ObjectSetInteger(IDchart,name,OBJPROP_ZORDER,0);
   ObjectSetInteger(IDchart,name,OBJPROP_BGCOLOR,bg_color);
    ObjectSetString(IDchart,name,OBJPROP_TOOLTIP,"\n");}}
//+----SetLabel Function---------------------------------------------------------------------------------------------+
   void SetLabel(long IDchart=0,string name="Label",int window=0,int corner=0,int PosX=0,int PosY=0,string thetext=" ",
   int fontsize=12,string fontname="Arial",int colour=0,double angle=0,bool back=true,bool del=false,int vis=0,
   int align=ANCHOR_LEFT_UPPER,bool HideObjects=true){if(del) ObjectDelete(IDchart,name);
   corner=MathMax(corner,0);  window=MathMax(window,0);
   if(colour<0) colour = White;
   if(fontsize==0) fontsize = 8;
   if(fontname=="")  fontname = "Arial";
      if(ObjectFind(IDchart,name) < 0)
       ObjectCreate(IDchart,name,OBJ_LABEL,window,0,0,0,0);
   ObjectSetInteger(IDchart,name,OBJPROP_CORNER,corner);
   ObjectSetInteger(IDchart,name,OBJPROP_XDISTANCE,PosX);
   ObjectSetInteger(IDchart,name,OBJPROP_YDISTANCE,PosY);
    ObjectSetString(IDchart,name,OBJPROP_TEXT,thetext);
   ObjectSetInteger(IDchart,name,OBJPROP_FONTSIZE,fontsize);
    ObjectSetString(IDchart,name,OBJPROP_FONT,fontname);
   ObjectSetInteger(IDchart,name,OBJPROP_COLOR,colour);
    ObjectSetDouble(IDchart,name,OBJPROP_ANGLE,angle);
   ObjectSetInteger(IDchart,name,OBJPROP_BACK,back);
   ObjectSetInteger(IDchart,name,OBJPROP_TIMEFRAMES,vis);
   ObjectSetInteger(IDchart,name,OBJPROP_ANCHOR,align);
   ObjectSetInteger(IDchart,name,OBJPROP_HIDDEN,HideObjects);
    ObjectSetString(IDchart,name,OBJPROP_TOOLTIP,"\n");}
//+------------------------------------------------------------------------------------------------------------------+